<template>
  <div>
    <header-list :city="city"></header-list>
    <home-swiper :swipers="swiperList"></home-swiper>
    <home-icons :icoms="iconList"></home-icons>
    <home-recommend :list="recommendList"></home-recommend>
    <home-weekend :list="weekendList"></home-weekend>
  </div>


</template>

<script>
import HeaderList from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeekend from './components/Weekend'
import axios from 'axios'
export default {
  name: "Home",
  components: {
    HeaderList,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },
  mounted() {
    this.getHomeInfo()
  },
  data(){
    return {
      city:"",
      iconList:[],
      recommendList:[],
      swiperList:[],
      weekendList:[]
    }
  },
  methods:{
    getHomeInfo(){
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc(res){
     res = res.data;
     if (res.ret && res.data){
      const data = res.data;
      this.city = data.city;
      this.iconList = data.iconList
       this.recommendList = data.recommendList
       this.swiperList = data.swiperList
       this.weekendList = data.weekendList

     }
    }
  }
}
</script>

<style scoped>

</style>
